winsafe\comctl\messages/
lvm.rs

1use crate::co;
2use crate::decl::*;
3use crate::kernel::privs::*;
4use crate::msg::*;
5use crate::ole::privs::*;
6use crate::prelude::*;
7use crate::user::privs::*;
8
9/// [`LVM_APPROXIMATEVIEWRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-approximateviewrect)
10/// message parameters.
11///
12/// Return type: `SIZE`.
13pub struct ApproximateViewRect {
14	pub num_items: Option<u32>,
15	pub proposed_x: Option<u16>,
16	pub proposed_y: Option<u16>,
17}
18
19impl MsgSend for ApproximateViewRect {
20	type RetType = SIZE;
21
22	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
23		SIZE::from(v as u32)
24	}
25
26	fn as_generic_wm(&mut self) -> WndMsg {
27		WndMsg {
28			msg_id: co::LVM::APPROXIMATEVIEWRECT.into(),
29			wparam: self.num_items.map_or(-1, |n| n as i32) as _,
30			lparam: MAKEDWORD(
31				self.proposed_x.map_or(-1, |x| x as i32) as _,
32				self.proposed_y.map_or(-1, |y| y as i32) as _,
33			) as _,
34		}
35	}
36}
37
38/// [`LVM_ARRANGE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-arrange)
39/// message parameters.
40///
41/// Return type: `SysResult<()>`.
42pub struct Arrange {
43	pub arrangement: co::LVA,
44}
45
46impl MsgSend for Arrange {
47	type RetType = SysResult<()>;
48
49	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
50		zero_as_badargs(v).map(|_| ())
51	}
52
53	fn as_generic_wm(&mut self) -> WndMsg {
54		WndMsg {
55			msg_id: co::LVM::ARRANGE.into(),
56			wparam: self.arrangement.raw() as _,
57			lparam: 0,
58		}
59	}
60}
61
62pub_struct_msg_empty! { CancelEditLabel: co::LVM::CANCELEDITLABEL.into();
63	/// [`LVM_CANCELEDITLABEL`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-canceleditlabel)
64}
65
66/// [`LVM_CREATEDRAGIMAGE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-createdragimage)
67/// message parameters.
68///
69/// Return type: `SysResult<HIMAGELIST>`.
70pub struct CreateDragImage<'a> {
71	pub index: u32,
72	pub img_location: &'a mut RECT,
73}
74
75impl<'a> MsgSend for CreateDragImage<'a> {
76	type RetType = SysResult<HIMAGELIST>;
77
78	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
79		zero_as_badargs(v).map(|p| HIMAGELIST::from_ptr(p as _))
80	}
81
82	fn as_generic_wm(&mut self) -> WndMsg {
83		WndMsg {
84			msg_id: co::LVM::CREATEDRAGIMAGE.into(),
85			wparam: self.index as _,
86			lparam: self.img_location as *mut _ as _,
87		}
88	}
89}
90
91/// [`LVM_DELETEALLITEMS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-deleteallitems)
92/// message, which has no parameters.
93///
94/// Return type: `SysResult<()>`.
95pub struct DeleteAllItems {}
96
97impl MsgSend for DeleteAllItems {
98	type RetType = SysResult<()>;
99
100	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
101		zero_as_badargs(v).map(|_| ())
102	}
103
104	fn as_generic_wm(&mut self) -> WndMsg {
105		WndMsg {
106			msg_id: co::LVM::DELETEALLITEMS.into(),
107			wparam: 0,
108			lparam: 0,
109		}
110	}
111}
112
113/// [`LVM_DELETECOLUMN`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-deletecolumn)
114/// message parameters.
115///
116/// Return type: `SysResult<()>`.
117pub struct DeleteColumn {
118	pub index: u32,
119}
120
121impl MsgSend for DeleteColumn {
122	type RetType = SysResult<()>;
123
124	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
125		zero_as_badargs(v).map(|_| ())
126	}
127
128	fn as_generic_wm(&mut self) -> WndMsg {
129		WndMsg {
130			msg_id: co::LVM::DELETECOLUMN.into(),
131			wparam: self.index as _,
132			lparam: 0,
133		}
134	}
135}
136
137/// [`LVM_DELETEITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-deleteitem)
138/// message parameters.
139///
140/// Return type: `SysResult<()>`.
141pub struct DeleteItem {
142	pub index: u32,
143}
144
145impl MsgSend for DeleteItem {
146	type RetType = SysResult<()>;
147
148	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
149		zero_as_badargs(v).map(|_| ())
150	}
151
152	fn as_generic_wm(&mut self) -> WndMsg {
153		WndMsg {
154			msg_id: co::LVM::DELETEITEM.into(),
155			wparam: self.index as _,
156			lparam: 0,
157		}
158	}
159}
160
161/// [`LVM_EDITLABEL`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-editlabel)
162/// message parameters.
163///
164/// Return type: `SysResult<HWND>`.
165pub struct EditLabel {
166	pub index: Option<u32>,
167}
168
169impl MsgSend for EditLabel {
170	type RetType = SysResult<HWND>;
171
172	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
173		zero_as_badargs(v).map(|p| HWND::from_ptr(p as _))
174	}
175
176	fn as_generic_wm(&mut self) -> WndMsg {
177		WndMsg {
178			msg_id: co::LVM::EDITLABEL.into(),
179			wparam: self.index.map_or(-1, |i| i as i32) as _,
180			lparam: 0,
181		}
182	}
183}
184
185/// [`LVM_ENABLEGROUPVIEW`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-enablegroupview)
186/// message parameters.
187///
188/// Return type: `SysResult<bool>`.
189pub struct EnableGroupView {
190	pub enable: bool,
191}
192
193impl MsgSend for EnableGroupView {
194	type RetType = SysResult<bool>;
195
196	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
197		minus1_as_badargs(v).map(|v| v != 0)
198	}
199
200	fn as_generic_wm(&mut self) -> WndMsg {
201		WndMsg {
202			msg_id: co::LVM::ENABLEGROUPVIEW.into(),
203			wparam: self.enable as _,
204			lparam: 0,
205		}
206	}
207}
208
209/// [`LVM_ENSUREVISIBLE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-ensurevisible)
210/// message parameters.
211///
212/// Return type: `SysResult<()>`.
213pub struct EnsureVisible {
214	pub index: u32,
215	pub entirely_visible: bool,
216}
217
218impl MsgSend for EnsureVisible {
219	type RetType = SysResult<()>;
220
221	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
222		zero_as_badargs(v).map(|_| ())
223	}
224
225	fn as_generic_wm(&mut self) -> WndMsg {
226		WndMsg {
227			msg_id: co::LVM::ENSUREVISIBLE.into(),
228			wparam: self.index as _,
229			lparam: !self.entirely_visible as _,
230		}
231	}
232}
233
234/// [`LVM_FINDITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-finditem)
235/// message parameters.
236///
237/// Return type: `Option<u32>`.
238pub struct FindItem<'a, 'b> {
239	pub start_index: Option<u32>,
240	pub lvfindinfo: &'b LVFINDINFO<'a>,
241}
242
243impl<'a, 'b> MsgSend for FindItem<'a, 'b> {
244	type RetType = Option<u32>;
245
246	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
247		minus1_as_none(v).map(|v| v as _)
248	}
249
250	fn as_generic_wm(&mut self) -> WndMsg {
251		WndMsg {
252			msg_id: co::LVM::FINDITEM.into(),
253			wparam: self.start_index.map_or(-1, |idx| idx as i32) as _,
254			lparam: self.lvfindinfo as *const _ as _,
255		}
256	}
257}
258
259/// [`LVM_GETBKCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getbkcolor)
260/// message, which has no parameters.
261///
262/// Return type: `COLORREF`.
263pub struct GetBkColor {}
264
265impl MsgSend for GetBkColor {
266	type RetType = COLORREF;
267
268	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
269		COLORREF::from_raw(v as _)
270	}
271
272	fn as_generic_wm(&mut self) -> WndMsg {
273		WndMsg {
274			msg_id: co::LVM::GETBKCOLOR.into(),
275			wparam: 0,
276			lparam: 0,
277		}
278	}
279}
280
281/// [`LVM_GETBKIMAGE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getbkimage)
282/// message parameters.
283///
284/// Return type: `SysResult<()>`.
285pub struct GetBkImage<'a, 'b> {
286	pub lvbkimage: &'b mut LVBKIMAGE<'a>,
287}
288
289impl<'a, 'b> MsgSend for GetBkImage<'a, 'b> {
290	type RetType = SysResult<()>;
291
292	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
293		zero_as_badargs(v).map(|_| ())
294	}
295
296	fn as_generic_wm(&mut self) -> WndMsg {
297		WndMsg {
298			msg_id: co::LVM::GETBKIMAGE.into(),
299			wparam: 0,
300			lparam: self.lvbkimage as *mut _ as _,
301		}
302	}
303}
304
305/// [`LVM_GETCALLBACKMASK`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getcallbackmask)
306/// message, which has no parameters.
307///
308/// Return type: `co::LVIS`.
309pub struct GetCallbackMask {}
310
311impl MsgSend for GetCallbackMask {
312	type RetType = co::LVIS;
313
314	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
315		co::LVIS::from_raw(v as _)
316	}
317
318	fn as_generic_wm(&mut self) -> WndMsg {
319		WndMsg {
320			msg_id: co::LVM::GETCALLBACKMASK.into(),
321			wparam: 0,
322			lparam: 0,
323		}
324	}
325}
326
327/// [`LVM_GETCOLUMN`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getcolumn)
328/// message parameters.
329///
330/// Return type: `SysResult<()>`.
331pub struct GetColumn<'a, 'b> {
332	pub index: u32,
333	pub lvcolumn: &'b mut LVCOLUMN<'a>,
334}
335
336impl<'a, 'b> MsgSend for GetColumn<'a, 'b> {
337	type RetType = SysResult<()>;
338
339	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
340		zero_as_badargs(v).map(|_| ())
341	}
342
343	fn as_generic_wm(&mut self) -> WndMsg {
344		WndMsg {
345			msg_id: co::LVM::GETCOLUMN.into(),
346			wparam: self.index as _,
347			lparam: self.lvcolumn as *mut _ as _,
348		}
349	}
350}
351
352/// [`LVM_GETCOLUMNORDERARRAY`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getcolumnorderarray)
353/// message parameters.
354///
355/// Return type: `SysResult<()>`.
356pub struct GetColumnOrderArray<'a> {
357	pub indexes: &'a mut Vec<u32>,
358}
359
360impl<'a> MsgSend for GetColumnOrderArray<'a> {
361	type RetType = SysResult<()>;
362
363	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
364		zero_as_badargs(v).map(|_| ())
365	}
366
367	fn as_generic_wm(&mut self) -> WndMsg {
368		WndMsg {
369			msg_id: co::LVM::GETCOLUMNORDERARRAY.into(),
370			wparam: self.indexes.len() as _,
371			lparam: self.indexes.as_mut_ptr() as _,
372		}
373	}
374}
375
376/// [`LVM_GETCOLUMNWIDTH`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getcolumnwidth)
377/// message parameters.
378///
379/// Return type: `SysResult<u32>`.
380pub struct GetColumnWidth {
381	pub index: u32,
382}
383
384impl MsgSend for GetColumnWidth {
385	type RetType = SysResult<u32>;
386
387	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
388		minus1_as_badargs(v).map(|v| v as _)
389	}
390
391	fn as_generic_wm(&mut self) -> WndMsg {
392		WndMsg {
393			msg_id: co::LVM::GETCOLUMNWIDTH.into(),
394			wparam: self.index as _,
395			lparam: 0,
396		}
397	}
398}
399
400/// [`LVM_GETCOUNTPERPAGE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getcountperpage)
401/// message, which has no parameters.
402///
403/// Return type: `u32`.
404pub struct GetCountPerPage {}
405
406impl MsgSend for GetCountPerPage {
407	type RetType = u32;
408
409	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
410		v as _
411	}
412
413	fn as_generic_wm(&mut self) -> WndMsg {
414		WndMsg {
415			msg_id: co::LVM::GETCOUNTPERPAGE.into(),
416			wparam: 0,
417			lparam: 0,
418		}
419	}
420}
421
422/// [`LVM_EDITCONTROL`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-geteditcontrol)
423/// message, which has no parameters.
424///
425/// Return type: `Option<HWND>`.
426pub struct GetEditControl {}
427
428impl MsgSend for GetEditControl {
429	type RetType = Option<HWND>;
430
431	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
432		zero_as_none(v).map(|p| HWND::from_ptr(p as _))
433	}
434
435	fn as_generic_wm(&mut self) -> WndMsg {
436		WndMsg {
437			msg_id: co::LVM::GETEDITCONTROL.into(),
438			wparam: 0,
439			lparam: 0,
440		}
441	}
442}
443
444/// [`LVM_GETEMPTYTEXT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getemptytext)
445/// message parameters.
446///
447/// Return type: `SysResult<()>`.
448pub struct GetEmptyText<'a> {
449	pub text: &'a mut WString,
450}
451
452impl<'a> MsgSend for GetEmptyText<'a> {
453	type RetType = SysResult<()>;
454
455	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
456		zero_as_badargs(v).map(|_| ())
457	}
458
459	fn as_generic_wm(&mut self) -> WndMsg {
460		WndMsg {
461			msg_id: co::LVM::GETEMPTYTEXT.into(),
462			wparam: self.text.buf_len(),
463			lparam: unsafe { self.text.as_mut_ptr() } as _,
464		}
465	}
466}
467
468/// [`LVM_GETEXTENDEDLISTVIEWSTYLE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getextendedlistviewstyle)
469/// message, which has no parameters.
470///
471/// Return type: `co::LVS_EX`.
472pub struct GetExtendedListViewStyle {}
473
474impl MsgSend for GetExtendedListViewStyle {
475	type RetType = co::LVS_EX;
476
477	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
478		co::LVS_EX::from_raw(v as _)
479	}
480
481	fn as_generic_wm(&mut self) -> WndMsg {
482		WndMsg {
483			msg_id: co::LVM::GETEXTENDEDLISTVIEWSTYLE.into(),
484			wparam: 0,
485			lparam: 0,
486		}
487	}
488}
489
490/// [`LVM_GETFOCUSEDGROUP`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getfocusedgroup)
491/// message, which has no parameters.
492///
493/// Return type: `Option<u32>`.
494pub struct GetFocusedGroup {}
495
496impl MsgSend for GetFocusedGroup {
497	type RetType = Option<u32>;
498
499	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
500		minus1_as_none(v).map(|v| v as _)
501	}
502
503	fn as_generic_wm(&mut self) -> WndMsg {
504		WndMsg {
505			msg_id: co::LVM::GETFOCUSEDGROUP.into(),
506			wparam: 0,
507			lparam: 0,
508		}
509	}
510}
511
512/// [`LVM_GETFOOTERINFO`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getfooterinfo)
513/// message parameters.
514///
515/// Return type: `()`.
516pub struct GetFooterInfo<'a, 'b> {
517	pub info: &'b mut LVFOOTERINFO<'a>,
518}
519
520impl<'a, 'b> MsgSend for GetFooterInfo<'a, 'b> {
521	type RetType = ();
522
523	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
524		()
525	}
526
527	fn as_generic_wm(&mut self) -> WndMsg {
528		WndMsg {
529			msg_id: co::LVM::GETFOOTERINFO.into(),
530			wparam: 0,
531			lparam: self.info as *mut _ as _,
532		}
533	}
534}
535
536/// [`LVM_GETFOOTERITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getfooteritem)
537/// message parameters.
538///
539/// Return type: `SysResult<()>`.
540pub struct GetFooterItem<'a, 'b> {
541	pub index: u32,
542	pub info: &'b mut LVFOOTERITEM<'a>,
543}
544
545impl<'a, 'b> MsgSend for GetFooterItem<'a, 'b> {
546	type RetType = SysResult<()>;
547
548	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
549		zero_as_badargs(v).map(|_| ())
550	}
551
552	fn as_generic_wm(&mut self) -> WndMsg {
553		WndMsg {
554			msg_id: co::LVM::GETFOOTERITEM.into(),
555			wparam: self.index as _,
556			lparam: self.info as *mut _ as _,
557		}
558	}
559}
560
561/// [`LVM_GETFOOTERITEMRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getfooteritemrect)
562/// message parameters.
563///
564/// Return type: `SysResult<()>`.
565pub struct GetFooterItemRect<'a> {
566	pub index: u32,
567	pub rect: &'a mut RECT,
568}
569
570impl<'a> MsgSend for GetFooterItemRect<'a> {
571	type RetType = SysResult<()>;
572
573	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
574		zero_as_badargs(v).map(|_| ())
575	}
576
577	fn as_generic_wm(&mut self) -> WndMsg {
578		WndMsg {
579			msg_id: co::LVM::GETFOOTERITEMRECT.into(),
580			wparam: self.index as _,
581			lparam: self.rect as *mut _ as _,
582		}
583	}
584}
585
586/// [`LVM_GETFOOTERRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getfooterrect)
587/// message parameters.
588///
589/// Return type: `SysResult<()>`.
590pub struct GetFooterRect<'a> {
591	pub rect: &'a mut RECT,
592}
593
594impl<'a> MsgSend for GetFooterRect<'a> {
595	type RetType = SysResult<()>;
596
597	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
598		zero_as_badargs(v).map(|_| ())
599	}
600
601	fn as_generic_wm(&mut self) -> WndMsg {
602		WndMsg {
603			msg_id: co::LVM::GETFOOTERRECT.into(),
604			wparam: 0,
605			lparam: self.rect as *mut _ as _,
606		}
607	}
608}
609
610/// [`LVM_GROUPCOUNT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getgroupcount)
611/// message, which has no parameters.
612///
613/// Return type: `u32`.
614pub struct GetGroupCount {}
615
616impl MsgSend for GetGroupCount {
617	type RetType = u32;
618
619	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
620		v as _
621	}
622
623	fn as_generic_wm(&mut self) -> WndMsg {
624		WndMsg {
625			msg_id: co::LVM::GETGROUPCOUNT.into(),
626			wparam: 0,
627			lparam: 0,
628		}
629	}
630}
631
632/// [`LVM_GROUPINFO`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getgroupinfo)
633/// message parameters.
634///
635/// Return type: `SysResult<u32>`.
636pub struct GetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
637	pub id: u32,
638	pub info: &'h mut LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
639}
640
641impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for GetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
642	type RetType = SysResult<u32>;
643
644	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
645		minus1_as_badargs(v).map(|v| v as _)
646	}
647
648	fn as_generic_wm(&mut self) -> WndMsg {
649		WndMsg {
650			msg_id: co::LVM::GETGROUPINFO.into(),
651			wparam: self.id as _,
652			lparam: self.info as *mut _ as _,
653		}
654	}
655}
656
657/// [`LVM_GETGROUPINFOBYINDEX`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getgroupinfobyindex)
658/// message parameters.
659///
660/// Return type: `SysResult<()>`.
661pub struct GetGroupInfoByIndex<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
662	pub index: u32,
663	pub info: &'h mut LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
664}
665
666impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend
667	for GetGroupInfoByIndex<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h>
668{
669	type RetType = SysResult<()>;
670
671	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
672		zero_as_badargs(v).map(|_| ())
673	}
674
675	fn as_generic_wm(&mut self) -> WndMsg {
676		WndMsg {
677			msg_id: co::LVM::GETGROUPINFOBYINDEX.into(),
678			wparam: self.index as _,
679			lparam: self.info as *mut _ as _,
680		}
681	}
682}
683
684/// [`LVM_GETGROUPMETRICS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getgroupmetrics)
685/// message parameters.
686///
687/// Return type: `()`.
688pub struct GetGroupMetrics<'a> {
689	pub info: &'a mut LVGROUPMETRICS,
690}
691
692impl<'a> MsgSend for GetGroupMetrics<'a> {
693	type RetType = ();
694
695	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
696		()
697	}
698
699	fn as_generic_wm(&mut self) -> WndMsg {
700		WndMsg {
701			msg_id: co::LVM::GETGROUPMETRICS.into(),
702			wparam: 0,
703			lparam: self.info as *mut _ as _,
704		}
705	}
706}
707
708/// [`LVM_GETGROUPRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getgrouprect)
709/// message parameters.
710///
711/// Return type: `SysResult<()>`.
712pub struct GetGroupRect<'a> {
713	pub id: u32,
714	pub flags: co::LVGGR,
715	pub rect: &'a mut RECT,
716}
717
718impl<'a> MsgSend for GetGroupRect<'a> {
719	type RetType = SysResult<()>;
720
721	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
722		zero_as_badargs(v).map(|_| ())
723	}
724
725	fn as_generic_wm(&mut self) -> WndMsg {
726		self.rect.top = self.flags.raw();
727
728		WndMsg {
729			msg_id: co::LVM::GETGROUPRECT.into(),
730			wparam: self.id as _,
731			lparam: self.rect as *mut _ as _,
732		}
733	}
734}
735
736/// [`LVM_GETGROUPSTATE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getgroupstate)
737/// message parameters.
738///
739/// Return type: `co::LVGS`.
740pub struct GetGroupState {
741	pub id: u32,
742	pub mask: co::LVGS,
743}
744
745impl MsgSend for GetGroupState {
746	type RetType = co::LVGS;
747
748	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
749		co::LVGS::from_raw(v as _)
750	}
751
752	fn as_generic_wm(&mut self) -> WndMsg {
753		WndMsg {
754			msg_id: co::LVM::GETGROUPSTATE.into(),
755			wparam: self.id as _,
756			lparam: self.mask.raw() as _,
757		}
758	}
759}
760
761/// [`LVM_GETHEADER`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getheader)
762/// message, which has no parameters.
763///
764/// Return type: `SysResult<HWND>`.
765pub struct GetHeader {}
766
767impl MsgSend for GetHeader {
768	type RetType = SysResult<HWND>;
769
770	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
771		zero_as_badargs(v).map(|p| HWND::from_ptr(p as _))
772	}
773
774	fn as_generic_wm(&mut self) -> WndMsg {
775		WndMsg {
776			msg_id: co::LVM::GETHEADER.into(),
777			wparam: 0,
778			lparam: 0,
779		}
780	}
781}
782
783/// [`LVM_GETHOTCURSOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gethotcursor)
784/// message, which has no parameters.
785///
786/// Return type: `SysResult<HCURSOR>`.
787pub struct GetHotCursor {}
788
789impl MsgSend for GetHotCursor {
790	type RetType = SysResult<HCURSOR>;
791
792	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
793		zero_as_badargs(v).map(|p| HCURSOR::from_ptr(p as _))
794	}
795
796	fn as_generic_wm(&mut self) -> WndMsg {
797		WndMsg {
798			msg_id: co::LVM::GETHOTCURSOR.into(),
799			wparam: 0,
800			lparam: 0,
801		}
802	}
803}
804
805/// [`LVM_GETHOTITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gethotitem)
806/// message, which has no parameters.
807///
808/// Return type: `Option<u32>`.
809pub struct GetHotItem {}
810
811impl MsgSend for GetHotItem {
812	type RetType = Option<u32>;
813
814	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
815		zero_as_none(v).map(|idx| idx as _)
816	}
817
818	fn as_generic_wm(&mut self) -> WndMsg {
819		WndMsg {
820			msg_id: co::LVM::GETHOTITEM.into(),
821			wparam: 0,
822			lparam: 0,
823		}
824	}
825}
826
827/// [`LVM_GETHOVERTIME`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gethovertime)
828/// message, which has no parameters.
829///
830/// Return type: `Option<u32>`.
831pub struct GetHoverTime {}
832
833impl MsgSend for GetHoverTime {
834	type RetType = Option<u32>;
835
836	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
837		zero_as_none(v).map(|idx| idx as _)
838	}
839
840	fn as_generic_wm(&mut self) -> WndMsg {
841		WndMsg {
842			msg_id: co::LVM::GETHOVERTIME.into(),
843			wparam: 0,
844			lparam: 0,
845		}
846	}
847}
848
849/// [`LVM_GETIMAGELIST`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getimagelist)
850/// message parameters.
851///
852/// Return type: `Option<HIMAGELIST>`.
853pub struct GetImageList {
854	pub kind: co::LVSIL,
855}
856
857impl MsgSend for GetImageList {
858	type RetType = Option<HIMAGELIST>;
859
860	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
861		zero_as_none(v).map(|p| HIMAGELIST::from_ptr(p as _))
862	}
863
864	fn as_generic_wm(&mut self) -> WndMsg {
865		WndMsg {
866			msg_id: co::LVM::GETIMAGELIST.into(),
867			wparam: self.kind.raw() as _,
868			lparam: 0,
869		}
870	}
871}
872
873/// [`LVM_GETINSERTMARK`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getinsertmark)
874/// message parameters.
875///
876/// Return type: `SysResult<()>`.
877pub struct GetInsertMark<'a> {
878	pub info: &'a mut LVINSERTMARK,
879}
880
881impl<'a> MsgSend for GetInsertMark<'a> {
882	type RetType = SysResult<()>;
883
884	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
885		zero_as_badargs(v).map(|_| ())
886	}
887
888	fn as_generic_wm(&mut self) -> WndMsg {
889		WndMsg {
890			msg_id: co::LVM::GETINSERTMARK.into(),
891			wparam: 0,
892			lparam: self.info as *mut _ as _,
893		}
894	}
895}
896
897/// [`LVM_GETINSERTMARKCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getinsertmarkcolor)
898/// message, which has no parameters.
899///
900/// Return type: `COLORREF`.
901pub struct GetInsertMarkColor {}
902
903impl MsgSend for GetInsertMarkColor {
904	type RetType = COLORREF;
905
906	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
907		COLORREF::from_raw(v as _)
908	}
909
910	fn as_generic_wm(&mut self) -> WndMsg {
911		WndMsg {
912			msg_id: co::LVM::GETINSERTMARKCOLOR.into(),
913			wparam: 0,
914			lparam: 0,
915		}
916	}
917}
918
919/// [`LVM_GETINSERTMARKRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getinsertmarkrect)
920/// message parameters.
921///
922/// Return type: `bool`.
923pub struct GetInsertMarkRect<'a> {
924	pub rect: &'a mut RECT,
925}
926
927impl<'a> MsgSend for GetInsertMarkRect<'a> {
928	type RetType = bool;
929
930	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
931		v != 0
932	}
933
934	fn as_generic_wm(&mut self) -> WndMsg {
935		WndMsg {
936			msg_id: co::LVM::GETINSERTMARKRECT.into(),
937			wparam: 0,
938			lparam: self.rect as *mut _ as _,
939		}
940	}
941}
942
943/// [`LVM_GETISEARCHSTRING`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getisearchstring)
944/// message parameters.
945///
946/// Return type: `Option<u32>`.
947pub struct GetISearchString<'a> {
948	pub buffer: Option<&'a mut WString>,
949}
950
951impl<'a> MsgSend for GetISearchString<'a> {
952	type RetType = Option<u32>;
953
954	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
955		zero_as_none(v).map(|c| c as _)
956	}
957
958	fn as_generic_wm(&mut self) -> WndMsg {
959		WndMsg {
960			msg_id: co::LVM::GETISEARCHSTRING.into(),
961			wparam: 0,
962			lparam: self
963				.buffer
964				.as_mut()
965				.map_or(0, |buf| unsafe { buf.as_mut_ptr() } as _),
966		}
967	}
968}
969
970/// [`LVM_GETITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitem)
971/// message parameters.
972///
973/// Return type: `SysResult<()>`.
974pub struct GetItem<'a, 'b> {
975	pub lvitem: &'b mut LVITEM<'a>,
976}
977
978impl<'a, 'b> MsgSend for GetItem<'a, 'b> {
979	type RetType = SysResult<()>;
980
981	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
982		zero_as_badargs(v).map(|_| ())
983	}
984
985	fn as_generic_wm(&mut self) -> WndMsg {
986		WndMsg {
987			msg_id: co::LVM::GETITEM.into(),
988			wparam: 0,
989			lparam: self.lvitem as *mut _ as _,
990		}
991	}
992}
993
994/// [`LVM_GETITEMCOUNT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitemcount)
995/// message, which has no parameters.
996///
997/// Return type: `u32`.
998pub struct GetItemCount {}
999
1000impl MsgSend for GetItemCount {
1001	type RetType = u32;
1002
1003	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1004		v as _
1005	}
1006
1007	fn as_generic_wm(&mut self) -> WndMsg {
1008		WndMsg {
1009			msg_id: co::LVM::GETITEMCOUNT.into(),
1010			wparam: 0,
1011			lparam: 0,
1012		}
1013	}
1014}
1015
1016/// [`LVM_GETITEMINDEXRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitemindexrect)
1017/// message parameters.
1018///
1019/// Return type: `SysResult<()>`.
1020pub struct GetItemIndexRect<'a, 'b> {
1021	pub lvitemindex: &'a LVITEMINDEX,
1022	pub rect: &'b mut RECT,
1023	pub index: u32,
1024	pub portion: co::LVIR,
1025}
1026
1027impl<'a, 'b> MsgSend for GetItemIndexRect<'a, 'b> {
1028	type RetType = SysResult<()>;
1029
1030	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1031		zero_as_badargs(v).map(|_| ())
1032	}
1033
1034	fn as_generic_wm(&mut self) -> WndMsg {
1035		self.rect.top = self.index as _;
1036		self.rect.left = self.portion.raw() as _;
1037
1038		WndMsg {
1039			msg_id: co::LVM::GETITEMINDEXRECT.into(),
1040			wparam: self.lvitemindex as *const _ as _,
1041			lparam: self.rect as *mut _ as _,
1042		}
1043	}
1044}
1045
1046/// [`LVM_GETITEMPOSITION`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitemposition)
1047/// message parameters.
1048///
1049/// Return type: `SysResult<()>`.
1050pub struct GetItemPosition<'a> {
1051	pub index: u32,
1052	pub pos: &'a mut POINT,
1053}
1054
1055impl<'a> MsgSend for GetItemPosition<'a> {
1056	type RetType = SysResult<()>;
1057
1058	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1059		zero_as_badargs(v).map(|_| ())
1060	}
1061
1062	fn as_generic_wm(&mut self) -> WndMsg {
1063		WndMsg {
1064			msg_id: co::LVM::GETITEMPOSITION.into(),
1065			wparam: self.index as _,
1066			lparam: self.pos as *mut _ as _,
1067		}
1068	}
1069}
1070
1071/// [`LVM_GETITEMRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitemrect)
1072/// message parameters.
1073///
1074/// Return type: `SysResult<()>`.
1075pub struct GetItemRect<'a> {
1076	pub index: u32,
1077	pub rect: &'a mut RECT,
1078	pub portion: co::LVIR,
1079}
1080
1081impl<'a> MsgSend for GetItemRect<'a> {
1082	type RetType = SysResult<()>;
1083
1084	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1085		zero_as_badargs(v).map(|_| ())
1086	}
1087
1088	fn as_generic_wm(&mut self) -> WndMsg {
1089		self.rect.left = self.portion.raw() as _;
1090
1091		WndMsg {
1092			msg_id: co::LVM::GETITEMRECT.into(),
1093			wparam: self.index as _,
1094			lparam: self.rect as *mut _ as _,
1095		}
1096	}
1097}
1098
1099/// [`LVM_GETITEMSPACING`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitemspacing)
1100/// message parameters.
1101///
1102/// Return type: `SIZE`.
1103pub struct GetItemSpacing {
1104	pub is_small_icon_view: bool,
1105}
1106
1107impl MsgSend for GetItemSpacing {
1108	type RetType = SIZE;
1109
1110	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1111		SIZE::from(v as u32)
1112	}
1113
1114	fn as_generic_wm(&mut self) -> WndMsg {
1115		WndMsg {
1116			msg_id: co::LVM::GETITEMSTATE.into(),
1117			wparam: self.is_small_icon_view as _,
1118			lparam: 0,
1119		}
1120	}
1121}
1122
1123/// [`LVM_GETITEMSTATE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitemstate)
1124/// message parameters.
1125///
1126/// Return type: `co::LVIS`.
1127pub struct GetItemState {
1128	pub index: u32,
1129	pub mask: co::LVIS,
1130}
1131
1132impl MsgSend for GetItemState {
1133	type RetType = co::LVIS;
1134
1135	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1136		co::LVIS::from_raw(v as _)
1137	}
1138
1139	fn as_generic_wm(&mut self) -> WndMsg {
1140		WndMsg {
1141			msg_id: co::LVM::GETITEMSTATE.into(),
1142			wparam: self.index as _,
1143			lparam: self.mask.raw() as _,
1144		}
1145	}
1146}
1147
1148/// [`LVM_GETITEMTEXT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getitemtext)
1149/// message parameters.
1150///
1151/// Return type: `u32`.
1152pub struct GetItemText<'a, 'b> {
1153	pub index: u32,
1154	pub lvitem: &'b mut LVITEM<'a>,
1155}
1156
1157impl<'a, 'b> MsgSend for GetItemText<'a, 'b> {
1158	type RetType = u32;
1159
1160	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1161		v as _
1162	}
1163
1164	fn as_generic_wm(&mut self) -> WndMsg {
1165		WndMsg {
1166			msg_id: co::LVM::GETITEMTEXT.into(),
1167			wparam: self.index as _,
1168			lparam: self.lvitem as *mut _ as _,
1169		}
1170	}
1171}
1172
1173/// [`LVM_GETNEXTITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getnextitem)
1174/// message parameters.
1175///
1176/// Return type: `Option<u32>`.
1177pub struct GetNextItem {
1178	pub initial_index: Option<u32>,
1179	pub relationship: co::LVNI,
1180}
1181
1182impl MsgSend for GetNextItem {
1183	type RetType = Option<u32>;
1184
1185	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1186		minus1_as_none(v).map(|v| v as _)
1187	}
1188
1189	fn as_generic_wm(&mut self) -> WndMsg {
1190		WndMsg {
1191			msg_id: co::LVM::GETNEXTITEM.into(),
1192			wparam: self.initial_index.map_or(-1, |idx| idx as i32) as _,
1193			lparam: self.relationship.raw() as _,
1194		}
1195	}
1196}
1197
1198/// [`LVM_GETNEXTITEMINDEX`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getnextitemindex)
1199/// message parameters.
1200///
1201/// Return type: `SysResult<()>`.
1202pub struct GetNextItemIndex<'a> {
1203	pub initial_item: &'a mut LVITEMINDEX,
1204	pub relationship: co::LVNI,
1205}
1206
1207impl<'a> MsgSend for GetNextItemIndex<'a> {
1208	type RetType = SysResult<()>;
1209
1210	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1211		zero_as_badargs(v).map(|_| ())
1212	}
1213
1214	fn as_generic_wm(&mut self) -> WndMsg {
1215		WndMsg {
1216			msg_id: co::LVM::GETNEXTITEMINDEX.into(),
1217			wparam: self.initial_item as *mut _ as _,
1218			lparam: self.relationship.raw() as _,
1219		}
1220	}
1221}
1222
1223/// [`LVM_GETNUMBEROFWORKAREAS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getnumberofworkareas)
1224/// message parameters.
1225///
1226/// Return type: `()`.
1227pub struct GetNumberOfWorkAreas<'a> {
1228	pub num: &'a mut u32,
1229}
1230
1231impl<'a> MsgSend for GetNumberOfWorkAreas<'a> {
1232	type RetType = ();
1233
1234	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
1235		()
1236	}
1237
1238	fn as_generic_wm(&mut self) -> WndMsg {
1239		WndMsg {
1240			msg_id: co::LVM::GETNUMBEROFWORKAREAS.into(),
1241			wparam: 0,
1242			lparam: self.num as *mut _ as _,
1243		}
1244	}
1245}
1246
1247/// [`LVM_GETORIGIN`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getorigin)
1248/// message parameters.
1249///
1250/// Return type: `bool`.
1251pub struct GetOrigin<'a> {
1252	pub origin: &'a mut POINT,
1253}
1254
1255impl<'a> MsgSend for GetOrigin<'a> {
1256	type RetType = bool;
1257
1258	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1259		v != 0
1260	}
1261
1262	fn as_generic_wm(&mut self) -> WndMsg {
1263		WndMsg {
1264			msg_id: co::LVM::GETORIGIN.into(),
1265			wparam: 0,
1266			lparam: self.origin as *mut _ as _,
1267		}
1268	}
1269}
1270
1271/// [`LVM_GETOUTLINECOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getoutlinecolor)
1272/// message, which has no parameters.
1273///
1274/// Return type: `COLORREF`.
1275pub struct GetOutlineColor {}
1276
1277impl MsgSend for GetOutlineColor {
1278	type RetType = COLORREF;
1279
1280	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1281		COLORREF::from_raw(v as _)
1282	}
1283
1284	fn as_generic_wm(&mut self) -> WndMsg {
1285		WndMsg {
1286			msg_id: co::LVM::GETOUTLINECOLOR.into(),
1287			wparam: 0,
1288			lparam: 0,
1289		}
1290	}
1291}
1292
1293/// [`LVM_GETSELECTEDCOLUMN`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getselectedcolumn)
1294/// message, which has no parameters.
1295///
1296/// Return type: `Option<u32>`.
1297pub struct GetSelectedColumn {}
1298
1299impl MsgSend for GetSelectedColumn {
1300	type RetType = Option<u32>;
1301
1302	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1303		minus1_as_none(v).map(|v| v as _)
1304	}
1305
1306	fn as_generic_wm(&mut self) -> WndMsg {
1307		WndMsg {
1308			msg_id: co::LVM::GETSELECTEDCOLUMN.into(),
1309			wparam: 0,
1310			lparam: 0,
1311		}
1312	}
1313}
1314
1315/// [`LVM_GETSELECTEDCOUNT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getselectedcount)
1316/// message, which has no parameters.
1317///
1318/// Return type: `u32`.
1319pub struct GetSelectedCount {}
1320
1321impl MsgSend for GetSelectedCount {
1322	type RetType = u32;
1323
1324	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1325		v as _
1326	}
1327
1328	fn as_generic_wm(&mut self) -> WndMsg {
1329		WndMsg {
1330			msg_id: co::LVM::GETSELECTEDCOUNT.into(),
1331			wparam: 0,
1332			lparam: 0,
1333		}
1334	}
1335}
1336
1337/// [`LVM_GETSELECTIONMARK`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getselectionmark)
1338/// message, which has no parameters.
1339///
1340/// Return type: `Option<u32>`.
1341pub struct GetSelectionMark {}
1342
1343impl MsgSend for GetSelectionMark {
1344	type RetType = Option<u32>;
1345
1346	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1347		minus1_as_none(v).map(|v| v as _)
1348	}
1349
1350	fn as_generic_wm(&mut self) -> WndMsg {
1351		WndMsg {
1352			msg_id: co::LVM::GETSELECTIONMARK.into(),
1353			wparam: 0,
1354			lparam: 0,
1355		}
1356	}
1357}
1358
1359/// [`LVM_GETSTRINGWIDTH`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getstringwidth)
1360/// message parameters.
1361///
1362/// Return type: `SysResult<u32>`.
1363pub struct GetStringWidth {
1364	pub text: WString,
1365}
1366
1367impl MsgSend for GetStringWidth {
1368	type RetType = SysResult<u32>;
1369
1370	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1371		zero_as_badargs(v).map(|len| len as _)
1372	}
1373
1374	fn as_generic_wm(&mut self) -> WndMsg {
1375		WndMsg {
1376			msg_id: co::LVM::GETSTRINGWIDTH.into(),
1377			wparam: 0,
1378			lparam: self.text.as_ptr() as _,
1379		}
1380	}
1381}
1382
1383/// [`LVM_GETSUBITEMRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getsubitemrect)
1384/// message parameters.
1385///
1386/// Return type: `SysResult<()>`.
1387pub struct GetSubItemRect<'a> {
1388	pub item_index: u32,
1389	pub subitem_index: u32,
1390	pub rect: &'a mut RECT,
1391	pub portion: co::LVIR,
1392}
1393
1394impl<'a> MsgSend for GetSubItemRect<'a> {
1395	type RetType = SysResult<()>;
1396
1397	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1398		zero_as_badargs(v).map(|_| ())
1399	}
1400
1401	fn as_generic_wm(&mut self) -> WndMsg {
1402		self.rect.left = self.portion.raw() as _;
1403		self.rect.top = self.subitem_index as _;
1404
1405		WndMsg {
1406			msg_id: co::LVM::GETSUBITEMRECT.into(),
1407			wparam: self.item_index as _,
1408			lparam: self.rect as *mut _ as _,
1409		}
1410	}
1411}
1412
1413/// [`LVM_GETTEXTBKCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gettextbkcolor)
1414/// message, which has no parameters.
1415///
1416/// Return type: `COLORREF`.
1417pub struct GetTextBkColor {}
1418
1419impl MsgSend for GetTextBkColor {
1420	type RetType = COLORREF;
1421
1422	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1423		COLORREF::from_raw(v as _)
1424	}
1425
1426	fn as_generic_wm(&mut self) -> WndMsg {
1427		WndMsg {
1428			msg_id: co::LVM::GETTEXTBKCOLOR.into(),
1429			wparam: 0,
1430			lparam: 0,
1431		}
1432	}
1433}
1434
1435/// [`LVM_GETTEXTCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gettextcolor)
1436/// message, which has no parameters.
1437///
1438/// Return type: `COLORREF`.
1439pub struct GetTextColor {}
1440
1441impl MsgSend for GetTextColor {
1442	type RetType = COLORREF;
1443
1444	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1445		COLORREF::from_raw(v as _)
1446	}
1447
1448	fn as_generic_wm(&mut self) -> WndMsg {
1449		WndMsg {
1450			msg_id: co::LVM::GETTEXTCOLOR.into(),
1451			wparam: 0,
1452			lparam: 0,
1453		}
1454	}
1455}
1456
1457/// [`LVM_GETTILEINFO`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gettileinfo)
1458/// message parameters.
1459///
1460/// Return type: `()`.
1461pub struct GetTileInfo<'a, 'b> {
1462	pub info: &'b mut LVTILEINFO<'a>,
1463}
1464
1465impl<'a, 'b> MsgSend for GetTileInfo<'a, 'b> {
1466	type RetType = ();
1467
1468	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
1469		()
1470	}
1471
1472	fn as_generic_wm(&mut self) -> WndMsg {
1473		WndMsg {
1474			msg_id: co::LVM::GETTILEINFO.into(),
1475			wparam: 0,
1476			lparam: self.info as *mut _ as _,
1477		}
1478	}
1479}
1480
1481/// [`LVM_GETTILEVIEWINFO`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gettileviewinfo)
1482/// message parameters.
1483///
1484/// Return type: `()`.
1485pub struct GetTileViewInfo<'a> {
1486	pub info: &'a mut LVTILEVIEWINFO,
1487}
1488
1489impl<'a> MsgSend for GetTileViewInfo<'a> {
1490	type RetType = ();
1491
1492	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
1493		()
1494	}
1495
1496	fn as_generic_wm(&mut self) -> WndMsg {
1497		WndMsg {
1498			msg_id: co::LVM::GETTILEVIEWINFO.into(),
1499			wparam: 0,
1500			lparam: self.info as *mut _ as _,
1501		}
1502	}
1503}
1504
1505/// [`LVM_GETTOOLTIPS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gettooltips)
1506/// message, which has no parameters.
1507///
1508/// Return type: `Option<HWND>`.
1509pub struct GetTooltips {}
1510
1511impl MsgSend for GetTooltips {
1512	type RetType = Option<HWND>;
1513
1514	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1515		zero_as_none(v).map(|p| HWND::from_ptr(p as _))
1516	}
1517
1518	fn as_generic_wm(&mut self) -> WndMsg {
1519		WndMsg {
1520			msg_id: co::LVM::GETTOOLTIPS.into(),
1521			wparam: 0,
1522			lparam: 0,
1523		}
1524	}
1525}
1526
1527/// [`LVM_GETTOPINDEX`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-gettopindex)
1528/// message, which has no parameters.
1529///
1530/// In case of error or when there are no items this message returns zero, so
1531/// other checks must be made.
1532///
1533/// Return type: `u32`.
1534pub struct GetTopIndex {}
1535
1536impl MsgSend for GetTopIndex {
1537	type RetType = u32;
1538
1539	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1540		v as _
1541	}
1542
1543	fn as_generic_wm(&mut self) -> WndMsg {
1544		WndMsg {
1545			msg_id: co::LVM::GETTOPINDEX.into(),
1546			wparam: 0,
1547			lparam: 0,
1548		}
1549	}
1550}
1551
1552/// [`LVM_GETUNICODEFORMAT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getunicodeformat)
1553/// message, which has no parameters.
1554///
1555/// Return type: `bool`.
1556pub struct GetUnicodeFormat {}
1557
1558impl MsgSend for GetUnicodeFormat {
1559	type RetType = bool;
1560
1561	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1562		v != 0
1563	}
1564
1565	fn as_generic_wm(&mut self) -> WndMsg {
1566		WndMsg {
1567			msg_id: co::LVM::GETUNICODEFORMAT.into(),
1568			wparam: 0,
1569			lparam: 0,
1570		}
1571	}
1572}
1573
1574/// [`LVM_GETVIEW`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getview)
1575/// message, which has no parameters.
1576///
1577/// Return type: `co::LV_VIEW`.
1578pub struct GetView {}
1579
1580impl MsgSend for GetView {
1581	type RetType = co::LV_VIEW;
1582
1583	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1584		co::LV_VIEW::from_raw(v as _)
1585	}
1586
1587	fn as_generic_wm(&mut self) -> WndMsg {
1588		WndMsg {
1589			msg_id: co::LVM::GETVIEW.into(),
1590			wparam: 0,
1591			lparam: 0,
1592		}
1593	}
1594}
1595
1596/// [`LVM_GETVIEWRECT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getviewrect)
1597/// message parameters.
1598///
1599/// Return type: `SysResult<()>`.
1600pub struct GetViewRect<'a> {
1601	pub rect: &'a mut RECT,
1602}
1603
1604impl<'a> MsgSend for GetViewRect<'a> {
1605	type RetType = SysResult<()>;
1606
1607	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1608		zero_as_badargs(v).map(|_| ())
1609	}
1610
1611	fn as_generic_wm(&mut self) -> WndMsg {
1612		WndMsg {
1613			msg_id: co::LVM::GETVIEWRECT.into(),
1614			wparam: 0,
1615			lparam: self.rect as *mut _ as _,
1616		}
1617	}
1618}
1619
1620/// [`LVM_GETWORKAREAS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-getworkareas)
1621/// message parameters.
1622///
1623/// Return type: `()`.
1624pub struct GetWorkAreas<'a> {
1625	pub rects: &'a mut [RECT],
1626}
1627
1628impl<'a> MsgSend for GetWorkAreas<'a> {
1629	type RetType = ();
1630
1631	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
1632		()
1633	}
1634
1635	fn as_generic_wm(&mut self) -> WndMsg {
1636		WndMsg {
1637			msg_id: co::LVM::GETWORKAREAS.into(),
1638			wparam: self.rects.len() as _,
1639			lparam: self.rects.as_mut_ptr() as _,
1640		}
1641	}
1642}
1643
1644/// [`LVM_HASGROUP`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-hasgroup)
1645/// message parameters.
1646///
1647/// Return type: `bool`.
1648pub struct HasGroup {
1649	pub id: u32,
1650}
1651
1652impl MsgSend for HasGroup {
1653	type RetType = bool;
1654
1655	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1656		v != 0
1657	}
1658
1659	fn as_generic_wm(&mut self) -> WndMsg {
1660		WndMsg {
1661			msg_id: co::LVM::HASGROUP.into(),
1662			wparam: self.id as _,
1663			lparam: 0,
1664		}
1665	}
1666}
1667
1668/// [`LVM_HITTEST`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-hittest)
1669/// message parameters.
1670///
1671/// Return type: `Option<u32>`.
1672pub struct HitTest<'a> {
1673	pub info: &'a mut LVHITTESTINFO,
1674}
1675
1676impl<'a> MsgSend for HitTest<'a> {
1677	type RetType = Option<u32>;
1678
1679	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1680		minus1_as_none(v).map(|v| v as _)
1681	}
1682
1683	fn as_generic_wm(&mut self) -> WndMsg {
1684		WndMsg {
1685			msg_id: co::LVM::HITTEST.into(),
1686			wparam: -1 as _,
1687			lparam: self.info as *mut _ as _,
1688		}
1689	}
1690}
1691
1692/// [`LVM_INSERTCOLUMN`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-insertcolumn)
1693/// message parameters.
1694///
1695/// Return type: `SysResult<u32>`.
1696pub struct InsertColumn<'a, 'b> {
1697	pub index: u32,
1698	pub column: &'b LVCOLUMN<'a>,
1699}
1700
1701impl<'a, 'b> MsgSend for InsertColumn<'a, 'b> {
1702	type RetType = SysResult<u32>;
1703
1704	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1705		minus1_as_badargs(v).map(|v| v as _)
1706	}
1707
1708	fn as_generic_wm(&mut self) -> WndMsg {
1709		WndMsg {
1710			msg_id: co::LVM::INSERTCOLUMN.into(),
1711			wparam: self.index as _,
1712			lparam: self.column as *const _ as _,
1713		}
1714	}
1715}
1716
1717/// [`LVM_INSERTGROUP`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-insertgroup)
1718/// message parameters.
1719///
1720/// Return type: `SysResult<u32>`.
1721pub struct InsertGroup<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
1722	pub group: &'h LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
1723}
1724
1725impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for InsertGroup<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
1726	type RetType = SysResult<u32>;
1727
1728	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1729		minus1_as_badargs(v).map(|v| v as _)
1730	}
1731
1732	fn as_generic_wm(&mut self) -> WndMsg {
1733		WndMsg {
1734			msg_id: co::LVM::INSERTGROUP.into(),
1735			wparam: 0,
1736			lparam: self.group as *const _ as _,
1737		}
1738	}
1739}
1740
1741/// [`LVM_INSERTGROUPSORTED`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-insertgroupsorted)
1742/// message parameters.
1743///
1744/// Return type: `()`.
1745pub struct InsertGroupSorted<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
1746	pub group: &'h LVINSERTGROUPSORTED<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
1747}
1748
1749impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for InsertGroupSorted<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
1750	type RetType = ();
1751
1752	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
1753		()
1754	}
1755
1756	fn as_generic_wm(&mut self) -> WndMsg {
1757		WndMsg {
1758			msg_id: co::LVM::INSERTGROUPSORTED.into(),
1759			wparam: 0,
1760			lparam: self.group as *const _ as _,
1761		}
1762	}
1763}
1764
1765/// [`LVM_INSERTITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-insertitem)
1766/// message parameters.
1767///
1768/// Return type: `SysResult<u32>`.
1769pub struct InsertItem<'a, 'b> {
1770	pub item: &'b LVITEM<'a>,
1771}
1772
1773impl<'a, 'b> MsgSend for InsertItem<'a, 'b> {
1774	type RetType = SysResult<u32>;
1775
1776	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1777		minus1_as_badargs(v).map(|v| v as _)
1778	}
1779
1780	fn as_generic_wm(&mut self) -> WndMsg {
1781		WndMsg {
1782			msg_id: co::LVM::INSERTITEM.into(),
1783			wparam: 0,
1784			lparam: self.item as *const _ as _,
1785		}
1786	}
1787}
1788
1789/// [`LVM_INSERTMARKHITTEST`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-insertmarkhittest)
1790/// message parameters.
1791///
1792/// Return type: `SysResult<()>`.
1793pub struct InsertMarkHitTest<'a> {
1794	pub point: POINT,
1795	pub insert_mark: &'a LVINSERTMARK,
1796}
1797
1798impl<'a, 'b> MsgSend for InsertMarkHitTest<'a> {
1799	type RetType = SysResult<()>;
1800
1801	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1802		zero_as_badargs(v).map(|_| ())
1803	}
1804
1805	fn as_generic_wm(&mut self) -> WndMsg {
1806		WndMsg {
1807			msg_id: co::LVM::INSERTMARKHITTEST.into(),
1808			wparam: &self.point as *const _ as _,
1809			lparam: self.insert_mark as *const _ as _,
1810		}
1811	}
1812}
1813
1814/// [`LVM_ISGROUPVIEWENABLED`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-isgroupviewenabled)
1815/// message, which has no parameters.
1816///
1817/// Return type: `bool`.
1818pub struct IsGroupViewEnabled {}
1819
1820impl MsgSend for IsGroupViewEnabled {
1821	type RetType = bool;
1822
1823	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1824		v != 0
1825	}
1826
1827	fn as_generic_wm(&mut self) -> WndMsg {
1828		WndMsg {
1829			msg_id: co::LVM::ISGROUPVIEWENABLED.into(),
1830			wparam: 0,
1831			lparam: 0,
1832		}
1833	}
1834}
1835
1836/// [`LVM_ISITEMVISIBLE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-isitemvisible)
1837/// message parameters.
1838///
1839/// Return type: `bool`.
1840pub struct IsItemVisible {
1841	pub index: u32,
1842}
1843
1844impl MsgSend for IsItemVisible {
1845	type RetType = bool;
1846
1847	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1848		v != 0
1849	}
1850
1851	fn as_generic_wm(&mut self) -> WndMsg {
1852		WndMsg {
1853			msg_id: co::LVM::ISITEMVISIBLE.into(),
1854			wparam: self.index as _,
1855			lparam: 0,
1856		}
1857	}
1858}
1859
1860/// [`LVM_MAPIDTOINDEX`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-mapidtoindex)
1861/// message parameters.
1862///
1863/// Return type: `Option<u32>`.
1864pub struct MapIdToIndex {
1865	pub id: u32,
1866}
1867
1868impl MsgSend for MapIdToIndex {
1869	type RetType = Option<u32>;
1870
1871	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1872		minus1_as_none(v).map(|v| v as _)
1873	}
1874
1875	fn as_generic_wm(&mut self) -> WndMsg {
1876		WndMsg {
1877			msg_id: co::LVM::MAPIDTOINDEX.into(),
1878			wparam: self.id as _,
1879			lparam: 0,
1880		}
1881	}
1882}
1883
1884/// [`LVM_MAPINDEXTOID`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-mapindextoid)
1885/// message parameters.
1886///
1887/// Return type: `Option<u32>`.
1888pub struct MapIndexToId {
1889	pub index: u32,
1890}
1891
1892impl MsgSend for MapIndexToId {
1893	type RetType = Option<u32>;
1894
1895	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1896		minus1_as_none(v).map(|v| v as _)
1897	}
1898
1899	fn as_generic_wm(&mut self) -> WndMsg {
1900		WndMsg {
1901			msg_id: co::LVM::MAPINDEXTOID.into(),
1902			wparam: self.index as _,
1903			lparam: 0,
1904		}
1905	}
1906}
1907
1908/// [`LVM_REDRAWITEMS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-redrawitems)
1909/// message parameters.
1910///
1911/// Return type: `SysResult<()>`.
1912pub struct RedrawItems {
1913	pub first_index: u32,
1914	pub last_index: u32,
1915}
1916
1917impl MsgSend for RedrawItems {
1918	type RetType = SysResult<()>;
1919
1920	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1921		zero_as_badargs(v).map(|_| ())
1922	}
1923
1924	fn as_generic_wm(&mut self) -> WndMsg {
1925		WndMsg {
1926			msg_id: co::LVM::REDRAWITEMS.into(),
1927			wparam: self.first_index as _,
1928			lparam: self.last_index as _,
1929		}
1930	}
1931}
1932
1933pub_struct_msg_empty! { RemoveAllGroups: co::LVM::REMOVEALLGROUPS.into();
1934	/// [`LVM_REMOVEALLGROUPS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-removeallgroups)
1935	/// message, which has no parameters.
1936	///
1937	/// Return type: `SysResult<()>`.
1938}
1939
1940/// [`LVM_REMOVEGROUP`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-removegroup)
1941/// message parameters.
1942///
1943/// Return type: `SysResult<u32>`.
1944pub struct RemoveGroup {
1945	pub id: u32,
1946}
1947
1948impl MsgSend for RemoveGroup {
1949	type RetType = SysResult<u32>;
1950
1951	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1952		zero_as_badargs(v).map(|id| id as _)
1953	}
1954
1955	fn as_generic_wm(&mut self) -> WndMsg {
1956		WndMsg {
1957			msg_id: co::LVM::REMOVEGROUP.into(),
1958			wparam: self.id as _,
1959			lparam: 0,
1960		}
1961	}
1962}
1963
1964/// [`LVM_SCROLL`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-scroll)
1965/// message parameters.
1966///
1967/// Return type: `SysResult<()>`.
1968pub struct Scroll {
1969	pub horizontal: i32,
1970	pub vertical: i32,
1971}
1972
1973impl MsgSend for Scroll {
1974	type RetType = SysResult<()>;
1975
1976	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
1977		zero_as_badargs(v).map(|_| ())
1978	}
1979
1980	fn as_generic_wm(&mut self) -> WndMsg {
1981		WndMsg {
1982			msg_id: co::LVM::SCROLL.into(),
1983			wparam: self.horizontal as _,
1984			lparam: self.vertical as _,
1985		}
1986	}
1987}
1988
1989/// [`LVM_SETBKCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setbkcolor)
1990/// message parameters.
1991///
1992/// Return type: `SysResult<()>`.
1993pub struct SetBkColor {
1994	pub color: Option<COLORREF>,
1995}
1996
1997impl MsgSend for SetBkColor {
1998	type RetType = SysResult<()>;
1999
2000	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2001		zero_as_badargs(v).map(|_| ())
2002	}
2003
2004	fn as_generic_wm(&mut self) -> WndMsg {
2005		WndMsg {
2006			msg_id: co::LVM::SETBKCOLOR.into(),
2007			wparam: 0,
2008			lparam: self.color.map_or(co::CLR::NONE.raw(), |c| c.raw()) as _,
2009		}
2010	}
2011}
2012
2013/// [`LVM_SETBKIMAGE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setbkimage)
2014/// message parameters.
2015///
2016/// Return type: `SysResult<()>`.
2017pub struct SetBkImage<'a, 'b> {
2018	pub lvbkimage: &'b LVBKIMAGE<'a>,
2019}
2020
2021impl<'a, 'b> MsgSend for SetBkImage<'a, 'b> {
2022	type RetType = SysResult<()>;
2023
2024	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2025		zero_as_badargs(v).map(|_| ())
2026	}
2027
2028	fn as_generic_wm(&mut self) -> WndMsg {
2029		WndMsg {
2030			msg_id: co::LVM::SETBKIMAGE.into(),
2031			wparam: 0,
2032			lparam: self.lvbkimage as *const _ as _,
2033		}
2034	}
2035}
2036
2037/// [`LVM_SETCALLBACKMASK`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setcallbackmask)
2038/// message parameters.
2039///
2040/// Return type: `SysResult<()>`.
2041pub struct SetCallbackMask {
2042	pub mask: co::LVIS,
2043}
2044
2045impl MsgSend for SetCallbackMask {
2046	type RetType = SysResult<()>;
2047
2048	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2049		zero_as_badargs(v).map(|_| ())
2050	}
2051
2052	fn as_generic_wm(&mut self) -> WndMsg {
2053		WndMsg {
2054			msg_id: co::LVM::SETCALLBACKMASK.into(),
2055			wparam: self.mask.raw() as _,
2056			lparam: 0,
2057		}
2058	}
2059}
2060
2061/// [`LVM_SETCOLUMN`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setcolumn)
2062/// message parameters.
2063///
2064/// Return type: `SysResult<()>`.
2065pub struct SetColumn<'a, 'b> {
2066	pub index: u32,
2067	pub lvcolumn: &'b LVCOLUMN<'a>,
2068}
2069
2070impl<'a, 'b> MsgSend for SetColumn<'a, 'b> {
2071	type RetType = SysResult<()>;
2072
2073	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2074		zero_as_badargs(v).map(|_| ())
2075	}
2076
2077	fn as_generic_wm(&mut self) -> WndMsg {
2078		WndMsg {
2079			msg_id: co::LVM::SETCOLUMN.into(),
2080			wparam: self.index as _,
2081			lparam: self.lvcolumn as *const _ as _,
2082		}
2083	}
2084}
2085
2086/// [`LVM_SETCOLUMNORDERARRAY`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setcolumnorderarray)
2087/// message parameters.
2088///
2089/// Return type: `SysResult<()>`.
2090pub struct SetColumnOrderArray<'a> {
2091	pub order: &'a [u32],
2092}
2093
2094impl<'a> MsgSend for SetColumnOrderArray<'a> {
2095	type RetType = SysResult<()>;
2096
2097	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2098		zero_as_badargs(v).map(|_| ())
2099	}
2100
2101	fn as_generic_wm(&mut self) -> WndMsg {
2102		WndMsg {
2103			msg_id: co::LVM::SETCOLUMNORDERARRAY.into(),
2104			wparam: self.order.len() as _,
2105			lparam: vec_ptr(self.order) as _,
2106		}
2107	}
2108}
2109
2110/// [`LVM_SETCOLUMNWIDTH`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setcolumnwidth)
2111/// message parameters.
2112///
2113/// Return type: `SysResult<()>`.
2114pub struct SetColumnWidth {
2115	pub index: u32,
2116	pub width: u32,
2117}
2118
2119impl MsgSend for SetColumnWidth {
2120	type RetType = SysResult<()>;
2121
2122	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2123		zero_as_badargs(v).map(|_| ())
2124	}
2125
2126	fn as_generic_wm(&mut self) -> WndMsg {
2127		WndMsg {
2128			msg_id: co::LVM::SETCOLUMNWIDTH.into(),
2129			wparam: self.index as _,
2130			lparam: self.width as _,
2131		}
2132	}
2133}
2134
2135/// [`LVM_SETEXTENDEDLISTVIEWSTYLE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setextendedlistviewstyle)
2136/// message parameters.
2137///
2138/// Return type: `co::LVS_EX`.
2139pub struct SetExtendedListViewStyle {
2140	pub style: co::LVS_EX,
2141	pub mask: co::LVS_EX,
2142}
2143
2144impl MsgSend for SetExtendedListViewStyle {
2145	type RetType = co::LVS_EX;
2146
2147	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2148		co::LVS_EX::from_raw(v as _)
2149	}
2150
2151	fn as_generic_wm(&mut self) -> WndMsg {
2152		WndMsg {
2153			msg_id: co::LVM::SETEXTENDEDLISTVIEWSTYLE.into(),
2154			wparam: self.style.raw() as _,
2155			lparam: self.mask.raw() as _,
2156		}
2157	}
2158}
2159
2160/// [`LVM_SETGROUPINFO`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setgroupinfo)
2161/// message parameters.
2162///
2163/// Return type: `SysResult<u32>`.
2164pub struct SetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
2165	pub id: u32,
2166	pub info: &'h LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
2167}
2168
2169impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for SetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
2170	type RetType = SysResult<u32>;
2171
2172	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2173		minus1_as_badargs(v).map(|v| v as _)
2174	}
2175
2176	fn as_generic_wm(&mut self) -> WndMsg {
2177		WndMsg {
2178			msg_id: co::LVM::SETGROUPINFO.into(),
2179			wparam: self.id as _,
2180			lparam: self.info as *const _ as _,
2181		}
2182	}
2183}
2184
2185/// [`LVM_SETGROUPMETRICS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setgroupmetrics)
2186/// message parameters.
2187///
2188/// Return type: `()`.
2189pub struct SetGroupMetrics<'a> {
2190	pub info: &'a LVGROUPMETRICS,
2191}
2192
2193impl<'a> MsgSend for SetGroupMetrics<'a> {
2194	type RetType = ();
2195
2196	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
2197		()
2198	}
2199
2200	fn as_generic_wm(&mut self) -> WndMsg {
2201		WndMsg {
2202			msg_id: co::LVM::SETGROUPMETRICS.into(),
2203			wparam: 0,
2204			lparam: self.info as *const _ as _,
2205		}
2206	}
2207}
2208
2209/// [`LVM_SETHOTCURSOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-sethotcursor)
2210/// message parameters.
2211///
2212/// Return type: `Option<HCURSOR>`.
2213pub struct SetHotCursor<'a> {
2214	pub hcursor: Option<&'a HCURSOR>,
2215}
2216
2217impl<'a> MsgSend for SetHotCursor<'a> {
2218	type RetType = Option<HCURSOR>;
2219
2220	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2221		zero_as_none(v).map(|p| HCURSOR::from_ptr(p as _))
2222	}
2223
2224	fn as_generic_wm(&mut self) -> WndMsg {
2225		WndMsg {
2226			msg_id: co::LVM::SETHOTCURSOR.into(),
2227			wparam: 0,
2228			lparam: self.hcursor.map_or(0, |h| h.ptr() as _),
2229		}
2230	}
2231}
2232
2233/// [`LVM_SETHOTITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-sethotitem)
2234/// message parameters.
2235///
2236/// Return type: `Option<u32>`.
2237pub struct SetHotItem {
2238	pub index: Option<u32>,
2239}
2240
2241impl MsgSend for SetHotItem {
2242	type RetType = Option<u32>;
2243
2244	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2245		minus1_as_none(v).map(|v| v as _)
2246	}
2247
2248	fn as_generic_wm(&mut self) -> WndMsg {
2249		WndMsg {
2250			msg_id: co::LVM::SETHOTITEM.into(),
2251			wparam: self.index.unwrap_or(0) as _,
2252			lparam: 0,
2253		}
2254	}
2255}
2256
2257/// [`LVM_SETHOVERTIME`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-sethovertime)
2258/// message parameters.
2259///
2260/// Return type: `Option<u32>`.
2261pub struct SetHoverTime {
2262	pub ms: Option<u32>,
2263}
2264
2265impl MsgSend for SetHoverTime {
2266	type RetType = Option<u32>;
2267
2268	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2269		minus1_as_none(v).map(|v| v as _)
2270	}
2271
2272	fn as_generic_wm(&mut self) -> WndMsg {
2273		WndMsg {
2274			msg_id: co::LVM::SETHOVERTIME.into(),
2275			wparam: self.ms.map_or(-1, |ms| ms as i32) as _,
2276			lparam: 0,
2277		}
2278	}
2279}
2280
2281/// [`LVM_SETICONSPACING`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-seticonspacing)
2282/// message parameters.
2283///
2284/// Return type: `SIZE`.
2285pub struct SetIconSpacing {
2286	pub size: SIZE,
2287}
2288
2289impl MsgSend for SetIconSpacing {
2290	type RetType = SIZE;
2291
2292	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2293		SIZE::from(v as u32)
2294	}
2295
2296	fn as_generic_wm(&mut self) -> WndMsg {
2297		WndMsg {
2298			msg_id: co::LVM::SETICONSPACING.into(),
2299			wparam: 0,
2300			lparam: u32::from(self.size) as _,
2301		}
2302	}
2303}
2304
2305/// [`LVM_SETIMAGELIST`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setimagelist)
2306/// message parameters.
2307///
2308/// Return type: `Option<HIMAGELIST>`.
2309pub struct SetImageList {
2310	pub kind: co::LVSIL,
2311	pub himagelist: Option<HIMAGELIST>,
2312}
2313
2314impl MsgSend for SetImageList {
2315	type RetType = Option<HIMAGELIST>;
2316
2317	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2318		zero_as_none(v).map(|p| HIMAGELIST::from_ptr(p as _))
2319	}
2320
2321	fn as_generic_wm(&mut self) -> WndMsg {
2322		WndMsg {
2323			msg_id: co::LVM::SETIMAGELIST.into(),
2324			wparam: self.kind.raw() as _,
2325			lparam: self.himagelist.as_ref().map_or(0, |h| h.ptr() as _),
2326		}
2327	}
2328}
2329
2330/// [`LVM_SETINFOTIP`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setinfotip)
2331/// message parameters.
2332///
2333/// Return type: `SysResult<()>`.
2334pub struct SetInfoTip<'a, 'b> {
2335	pub info: &'b LVSETINFOTIP<'a>,
2336}
2337
2338impl<'a, 'b> MsgSend for SetInfoTip<'a, 'b> {
2339	type RetType = SysResult<()>;
2340
2341	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2342		zero_as_badargs(v).map(|_| ())
2343	}
2344
2345	fn as_generic_wm(&mut self) -> WndMsg {
2346		WndMsg {
2347			msg_id: co::LVM::SETINFOTIP.into(),
2348			wparam: 0,
2349			lparam: self.info as *const _ as _,
2350		}
2351	}
2352}
2353
2354/// [`LVM_SETINSERTMARK`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setinsertmark)
2355/// message parameters.
2356///
2357/// Return type: `SysResult<()>`.
2358pub struct SetInsertMark<'a> {
2359	pub info: &'a LVINSERTMARK,
2360}
2361
2362impl<'a> MsgSend for SetInsertMark<'a> {
2363	type RetType = SysResult<()>;
2364
2365	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2366		zero_as_badargs(v).map(|_| ())
2367	}
2368
2369	fn as_generic_wm(&mut self) -> WndMsg {
2370		WndMsg {
2371			msg_id: co::LVM::SETINSERTMARK.into(),
2372			wparam: 0,
2373			lparam: self.info as *const _ as _,
2374		}
2375	}
2376}
2377
2378/// [`LVM_SETINSERTMARKCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setinsertmarkcolor)
2379/// message parameters.
2380///
2381/// Return type: `COLORREF`.
2382pub struct SetInsertMarkColor {
2383	pub color: COLORREF,
2384}
2385
2386impl MsgSend for SetInsertMarkColor {
2387	type RetType = COLORREF;
2388
2389	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2390		COLORREF::from_raw(v as _)
2391	}
2392
2393	fn as_generic_wm(&mut self) -> WndMsg {
2394		WndMsg {
2395			msg_id: co::LVM::SETINSERTMARKCOLOR.into(),
2396			wparam: 0,
2397			lparam: u32::from(self.color) as _,
2398		}
2399	}
2400}
2401
2402/// [`LVM_SETITEM`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setitem)
2403/// message parameters.
2404///
2405/// Return type: `SysResult<()>`.
2406pub struct SetItem<'a, 'b> {
2407	pub lvitem: &'b LVITEM<'a>,
2408}
2409
2410impl<'a, 'b> MsgSend for SetItem<'a, 'b> {
2411	type RetType = SysResult<()>;
2412
2413	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2414		zero_as_badargs(v).map(|_| ())
2415	}
2416
2417	fn as_generic_wm(&mut self) -> WndMsg {
2418		WndMsg {
2419			msg_id: co::LVM::SETITEM.into(),
2420			wparam: 0,
2421			lparam: self.lvitem as *const _ as _,
2422		}
2423	}
2424}
2425
2426/// [`LVM_SETITEMCOUNT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setitemcount)
2427/// message parameters.
2428///
2429/// Return type: `SysResult<()>`.
2430pub struct SetItemCount {
2431	pub count: u32,
2432	pub behavior: Option<co::LVSICF>,
2433}
2434
2435impl MsgSend for SetItemCount {
2436	type RetType = SysResult<()>;
2437
2438	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2439		zero_as_badargs(v).map(|_| ())
2440	}
2441
2442	fn as_generic_wm(&mut self) -> WndMsg {
2443		WndMsg {
2444			msg_id: co::LVM::SETITEMCOUNT.into(),
2445			wparam: self.count as _,
2446			lparam: self.behavior.unwrap_or_default().raw() as _,
2447		}
2448	}
2449}
2450
2451/// [`LVM_SETITEMINDEXSTATE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setitemindexstate)
2452/// message parameters.
2453///
2454/// Return type: `HrResult<()>`.
2455pub struct SetItemIndexState<'a, 'b, 'c> {
2456	pub lvitemindex: &'a LVITEMINDEX,
2457	pub lvitem: &'c LVITEM<'b>,
2458}
2459
2460impl<'a, 'b, 'c> MsgSend for SetItemIndexState<'a, 'b, 'c> {
2461	type RetType = HrResult<()>;
2462
2463	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2464		ok_to_hrresult(v as _)
2465	}
2466
2467	fn as_generic_wm(&mut self) -> WndMsg {
2468		WndMsg {
2469			msg_id: co::LVM::SETITEMINDEXSTATE.into(),
2470			wparam: self.lvitemindex as *const _ as _,
2471			lparam: self.lvitem as *const _ as _,
2472		}
2473	}
2474}
2475
2476/// [`LVM_SETITEMPOSITION`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setitemposition)
2477/// message parameters.
2478///
2479/// Return type: `SysResult<()>`.
2480pub struct SetItemPosition {
2481	pub index: u32,
2482	pub position: POINT,
2483}
2484
2485impl MsgSend for SetItemPosition {
2486	type RetType = SysResult<()>;
2487
2488	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2489		zero_as_badargs(v).map(|_| ())
2490	}
2491
2492	fn as_generic_wm(&mut self) -> WndMsg {
2493		WndMsg {
2494			msg_id: co::LVM::SETITEMPOSITION.into(),
2495			wparam: self.index as _,
2496			lparam: u32::from(self.position) as _,
2497		}
2498	}
2499}
2500
2501/// [`LVM_SETITEMPOSITION32`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setitemposition32)
2502/// message parameters.
2503///
2504/// Return type: `()`.
2505pub struct SetItemPosition32 {
2506	pub index: u32,
2507	pub position: POINT,
2508}
2509
2510impl MsgSend for SetItemPosition32 {
2511	type RetType = ();
2512
2513	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
2514		()
2515	}
2516
2517	fn as_generic_wm(&mut self) -> WndMsg {
2518		WndMsg {
2519			msg_id: co::LVM::SETITEMPOSITION32.into(),
2520			wparam: self.index as _,
2521			lparam: &self.position as *const _ as _,
2522		}
2523	}
2524}
2525
2526/// [`LVM_SETITEMSTATE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setitemstate)
2527/// message parameters.
2528///
2529/// Return type: `SysResult<()>`.
2530pub struct SetItemState<'a, 'b> {
2531	pub index: Option<u32>,
2532	pub lvitem: &'b LVITEM<'a>,
2533}
2534
2535impl<'a, 'b> MsgSend for SetItemState<'a, 'b> {
2536	type RetType = SysResult<()>;
2537
2538	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2539		zero_as_badargs(v).map(|_| ())
2540	}
2541
2542	fn as_generic_wm(&mut self) -> WndMsg {
2543		WndMsg {
2544			msg_id: co::LVM::SETITEMSTATE.into(),
2545			wparam: self.index.map_or(-1, |idx| idx as i32) as _,
2546			lparam: self.lvitem as *const _ as _,
2547		}
2548	}
2549}
2550
2551/// [`LVM_SETITEMTEXT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setitemtext)
2552/// message parameters.
2553///
2554/// Return type: `SysResult<()>`.
2555pub struct SetItemText<'a, 'b> {
2556	pub index: u32,
2557	pub lvitem: &'b LVITEM<'a>,
2558}
2559
2560impl<'a, 'b> MsgSend for SetItemText<'a, 'b> {
2561	type RetType = SysResult<()>;
2562
2563	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2564		zero_as_badargs(v).map(|_| ())
2565	}
2566
2567	fn as_generic_wm(&mut self) -> WndMsg {
2568		WndMsg {
2569			msg_id: co::LVM::SETITEMTEXT.into(),
2570			wparam: self.index as _,
2571			lparam: self.lvitem as *const _ as _,
2572		}
2573	}
2574}
2575
2576/// [`LVM_SETOUTLINECOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setoutlinecolor)
2577/// message parameters.
2578///
2579/// Return type: `COLORREF`.
2580pub struct SetOutlineColor {
2581	pub color: COLORREF,
2582}
2583
2584impl MsgSend for SetOutlineColor {
2585	type RetType = COLORREF;
2586
2587	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2588		COLORREF::from_raw(v as _)
2589	}
2590
2591	fn as_generic_wm(&mut self) -> WndMsg {
2592		WndMsg {
2593			msg_id: co::LVM::SETOUTLINECOLOR.into(),
2594			wparam: 0,
2595			lparam: u32::from(self.color) as _,
2596		}
2597	}
2598}
2599
2600/// [`LVM_SETSELECTEDCOLUMN`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setselectedcolumn)
2601/// message parameters.
2602///
2603/// Return type: `()`.
2604pub struct SetSelectedColumn {
2605	pub index: u32,
2606}
2607
2608impl MsgSend for SetSelectedColumn {
2609	type RetType = ();
2610
2611	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
2612		()
2613	}
2614
2615	fn as_generic_wm(&mut self) -> WndMsg {
2616		WndMsg {
2617			msg_id: co::LVM::SETSELECTEDCOLUMN.into(),
2618			wparam: self.index as _,
2619			lparam: 0,
2620		}
2621	}
2622}
2623
2624/// [`LVM_SETSELECTIONMARK`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setselectionmark)
2625/// message parameters.
2626///
2627/// Return type: `Option<u32>`.
2628pub struct SetSelectionMark {
2629	pub index: Option<u32>,
2630}
2631
2632impl MsgSend for SetSelectionMark {
2633	type RetType = Option<u32>;
2634
2635	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2636		minus1_as_none(v).map(|v| v as _)
2637	}
2638
2639	fn as_generic_wm(&mut self) -> WndMsg {
2640		WndMsg {
2641			msg_id: co::LVM::SETSELECTIONMARK.into(),
2642			wparam: 0,
2643			lparam: self.index.map_or(-1, |idx| idx as i32) as _,
2644		}
2645	}
2646}
2647
2648/// [`LVM_SETTEXTBKCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-settextbkcolor)
2649/// message parameters.
2650///
2651/// Return type: `SysResult<()>`.
2652pub struct SetTextBkColor {
2653	pub color: Option<COLORREF>,
2654}
2655
2656impl MsgSend for SetTextBkColor {
2657	type RetType = SysResult<()>;
2658
2659	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2660		zero_as_badargs(v).map(|_| ())
2661	}
2662
2663	fn as_generic_wm(&mut self) -> WndMsg {
2664		WndMsg {
2665			msg_id: co::LVM::SETTEXTBKCOLOR.into(),
2666			wparam: 0,
2667			lparam: self.color.map_or(co::CLR::NONE.raw(), |c| c.raw()) as _,
2668		}
2669	}
2670}
2671
2672/// [`LVM_SETTEXTCOLOR`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-settextcolor)
2673/// message parameters.
2674///
2675/// Return type: `SysResult<()>`.
2676pub struct SetTextColor {
2677	pub color: Option<COLORREF>,
2678}
2679
2680impl MsgSend for SetTextColor {
2681	type RetType = SysResult<()>;
2682
2683	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2684		zero_as_badargs(v).map(|_| ())
2685	}
2686
2687	fn as_generic_wm(&mut self) -> WndMsg {
2688		WndMsg {
2689			msg_id: co::LVM::SETTEXTCOLOR.into(),
2690			wparam: 0,
2691			lparam: self.color.map_or(co::CLR::NONE.raw(), |c| c.raw()) as _,
2692		}
2693	}
2694}
2695
2696/// [`LVM_SETTILEINFO`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-settileinfo)
2697/// message parameters.
2698///
2699/// Return type: `SysResult<()>`.
2700pub struct SetTileInfo<'a, 'b> {
2701	pub info: &'b LVTILEINFO<'a>,
2702}
2703
2704impl<'a, 'b> MsgSend for SetTileInfo<'a, 'b> {
2705	type RetType = SysResult<()>;
2706
2707	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2708		zero_as_badargs(v).map(|_| ())
2709	}
2710
2711	fn as_generic_wm(&mut self) -> WndMsg {
2712		WndMsg {
2713			msg_id: co::LVM::SETTILEINFO.into(),
2714			wparam: 0,
2715			lparam: self.info as *const _ as _,
2716		}
2717	}
2718}
2719
2720/// [`LVM_SETTILEVIEWINFO`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-settileviewinfo)
2721/// message parameters.
2722///
2723/// Return type: `SysResult<()>`.
2724pub struct SetTileViewInfo<'a> {
2725	pub info: &'a LVTILEVIEWINFO,
2726}
2727
2728impl<'a> MsgSend for SetTileViewInfo<'a> {
2729	type RetType = SysResult<()>;
2730
2731	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2732		zero_as_badargs(v).map(|_| ())
2733	}
2734
2735	fn as_generic_wm(&mut self) -> WndMsg {
2736		WndMsg {
2737			msg_id: co::LVM::SETTILEVIEWINFO.into(),
2738			wparam: 0,
2739			lparam: self.info as *const _ as _,
2740		}
2741	}
2742}
2743
2744/// [`LVM_SETTOOLTIPS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-settooltips)
2745/// message parameters.
2746///
2747/// Return type: `Option<HWND>`.
2748pub struct SetTooltips<'a> {
2749	pub htooltips: Option<&'a HWND>,
2750}
2751
2752impl<'a> MsgSend for SetTooltips<'a> {
2753	type RetType = Option<HWND>;
2754
2755	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2756		zero_as_none(v).map(|p| HWND::from_ptr(p as _))
2757	}
2758
2759	fn as_generic_wm(&mut self) -> WndMsg {
2760		WndMsg {
2761			msg_id: co::LVM::SETTOOLTIPS.into(),
2762			wparam: self.htooltips.map_or(0, |h| h.ptr() as _),
2763			lparam: 0,
2764		}
2765	}
2766}
2767
2768/// [`LVM_SETUNICODEFORMAT`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setunicodeformat)
2769/// message parameters.
2770///
2771/// Return type: `bool`.
2772pub struct SetUnicodeFormat {
2773	pub use_unicode: bool,
2774}
2775
2776impl MsgSend for SetUnicodeFormat {
2777	type RetType = bool;
2778
2779	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2780		v != 0
2781	}
2782
2783	fn as_generic_wm(&mut self) -> WndMsg {
2784		WndMsg {
2785			msg_id: co::LVM::SETUNICODEFORMAT.into(),
2786			wparam: self.use_unicode as _,
2787			lparam: 0,
2788		}
2789	}
2790}
2791
2792/// [`LVM_SETVIEW`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setview)
2793/// message parameters.
2794///
2795/// Return type: `SysResult<()>`.
2796pub struct SetView {
2797	pub view: co::LV_VIEW,
2798}
2799
2800impl MsgSend for SetView {
2801	type RetType = SysResult<()>;
2802
2803	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2804		minus1_as_badargs(v).map(|_| ())
2805	}
2806
2807	fn as_generic_wm(&mut self) -> WndMsg {
2808		WndMsg {
2809			msg_id: co::LVM::SETVIEW.into(),
2810			wparam: self.view.raw() as _,
2811			lparam: 0,
2812		}
2813	}
2814}
2815
2816/// [`LVM_SETWORKAREAS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-setworkareas)
2817/// message parameters.
2818///
2819/// Return type: `()`.
2820pub struct SetWorkAreas<'a> {
2821	pub rects: Option<&'a [RECT]>,
2822}
2823
2824impl<'a> MsgSend for SetWorkAreas<'a> {
2825	type RetType = ();
2826
2827	unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
2828		()
2829	}
2830
2831	fn as_generic_wm(&mut self) -> WndMsg {
2832		WndMsg {
2833			msg_id: co::LVM::SETWORKAREAS.into(),
2834			wparam: self.rects.map_or(0, |r| r.len() as _),
2835			lparam: self.rects.map_or(0, |r| vec_ptr(r) as _),
2836		}
2837	}
2838}
2839
2840/// [`LVM_SORTGROUPS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-sortgroups)
2841/// message parameters.
2842///
2843/// Return type: `SysResult<()>`.
2844pub struct SortGroups {
2845	pub callback: Option<PFNLVGROUPCOMPARE>,
2846	pub param: Option<isize>,
2847}
2848
2849impl MsgSend for SortGroups {
2850	type RetType = SysResult<()>;
2851
2852	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2853		zero_as_badargs(v).map(|_| ())
2854	}
2855
2856	fn as_generic_wm(&mut self) -> WndMsg {
2857		WndMsg {
2858			msg_id: co::LVM::SORTGROUPS.into(),
2859			wparam: self.callback.map_or(0, |cb| cb as _),
2860			lparam: self.param.unwrap_or(0),
2861		}
2862	}
2863}
2864
2865/// [`LVM_SORTITEMS`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-sortitems)
2866/// message parameters.
2867///
2868/// Return type: `SysResult<()>`.
2869pub struct SortItems {
2870	pub param: isize,
2871	pub callback: PFNLVCOMPARE,
2872}
2873
2874impl MsgSend for SortItems {
2875	type RetType = SysResult<()>;
2876
2877	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2878		zero_as_badargs(v).map(|_| ())
2879	}
2880
2881	fn as_generic_wm(&mut self) -> WndMsg {
2882		WndMsg {
2883			msg_id: co::LVM::SORTITEMS.into(),
2884			wparam: self.param as _,
2885			lparam: self.callback as _,
2886		}
2887	}
2888}
2889
2890/// [`LVM_SORTITEMSEX`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-sortitemsex)
2891/// message parameters.
2892///
2893/// Return type: `SysResult<()>`.
2894pub struct SortItemsEx {
2895	pub param: isize,
2896	pub callback: PFNLVCOMPARE,
2897}
2898
2899impl MsgSend for SortItemsEx {
2900	type RetType = SysResult<()>;
2901
2902	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2903		zero_as_badargs(v).map(|_| ())
2904	}
2905
2906	fn as_generic_wm(&mut self) -> WndMsg {
2907		WndMsg {
2908			msg_id: co::LVM::SORTITEMSEX.into(),
2909			wparam: self.param as _,
2910			lparam: self.callback as _,
2911		}
2912	}
2913}
2914
2915/// [`LVM_SUBITEMHITTEST`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-subitemhittest)
2916/// message parameters.
2917///
2918/// Return type: `Option<u32>`.
2919pub struct SubItemHitTest<'a> {
2920	pub info: &'a mut LVHITTESTINFO,
2921}
2922
2923impl<'a> MsgSend for SubItemHitTest<'a> {
2924	type RetType = Option<u32>;
2925
2926	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2927		minus1_as_none(v).map(|v| v as _)
2928	}
2929
2930	fn as_generic_wm(&mut self) -> WndMsg {
2931		WndMsg {
2932			msg_id: co::LVM::SUBITEMHITTEST.into(),
2933			wparam: -1 as _,
2934			lparam: self.info as *mut _ as _,
2935		}
2936	}
2937}
2938
2939/// [`LVM_UPDATE`](https://learn.microsoft.com/en-us/windows/win32/controls/lvm-update)
2940/// message parameters.
2941///
2942/// Return type: `SysResult<()>`.
2943pub struct Update {
2944	pub index: u32,
2945}
2946
2947impl MsgSend for Update {
2948	type RetType = SysResult<()>;
2949
2950	unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
2951		zero_as_badargs(v).map(|_| ())
2952	}
2953
2954	fn as_generic_wm(&mut self) -> WndMsg {
2955		WndMsg {
2956			msg_id: co::LVM::UPDATE.into(),
2957			wparam: self.index as _,
2958			lparam: 0,
2959		}
2960	}
2961}